package cn.eonshine.cuba.lsms.modular.basic.service.impl;

import java.util.Date;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.eonshine.cuba.lsms.modular.basic.entity.SysLog;
import cn.eonshine.cuba.lsms.modular.basic.mapper.SysLogMapper;
import cn.eonshine.cuba.lsms.modular.basic.service.SysLogService;

@Service
@Transactional
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {

	@Override
	public IPage<SysLog> getCleanLog(long currentPageNo, Date lastEndDate) {
		Page<SysLog> page = new Page<SysLog>(currentPageNo, 2000);
		QueryWrapper<SysLog> queryWrapper = new QueryWrapper<SysLog>();
		queryWrapper.lambda().lt(SysLog::getCreateDate, lastEndDate);
		return this.baseMapper.selectPage(page, queryWrapper);
	}

}
